package com.basic;

import com.frame.struts.BaseBean;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class OppnentsForm extends BaseBean {
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public OppnentsForm() {
    }

	OppnentsEntity oppnents = new OppnentsEntity();
	private String oldId="";
	public String addOppnents() {
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		oppnents.setQyid(qyid);
		oppnents.setOptdate(new Date());
		oppnents.setOptrid(CommUtil.getUserId(request));
		try{
			if (factory.addOppnents(oppnents)) {
				//response.sendRedirect("/kehuzk/queryOppnents.jsp");
				return "success";
			}else
			{
				//response.sendRedirect("/basic/failed.jsp");
				return "failed";
			}
		}
	  catch (Exception e) 
	  {
		  e.printStackTrace();
	  }

			return "failed";
	}

	public String modifyOppnents(){
			HttpServletRequest request = ActionContext.getActionContext().
				getRequest();
			HttpServletResponse response = ActionContext.getActionContext().
				getResponse();
			BasicFactory factory = new BasicFactory();
			String qyid = (String) request.getSession().getAttribute("session_qyid");
			oppnents.setQyid(qyid);
			oppnents.setOptdate(new Date());
			oppnents.setOptrid(CommUtil.getUserId(request));
			factory.deleteOppnents(qyid,this.getOldId());
			try{
		    if(factory.addOppnents(oppnents))
		    {
				//response.sendRedirect("/basic/queryOppnents.jsp");
				return "success";
			}
		    else
		    {
		    	//response.sendRedirect("/basic/failed.jsp");
		    	return "failed";
		    }
		}
		catch (Exception e) 
		{
			e.printStackTrace();

		}

			return "failed";
		}
	
	
	
	
	public String getJzys2() {
		return oppnents.getJzys2();
	}
	public void setJzys2(String jzys2) {
		oppnents.setJzys2(jzys2);
	}
	
	public String getQywz() {
		return oppnents.getQywz();
	}
	public void setQywz(String qywz) {
		oppnents.setQywz(qywz);
	}
	
	
	public String getOldId(){
		return this.oldId;
	}
	public void setOldId(String oldId){
		this.oldId=oldId;
	}
	/**
 * @return Returns the bqycpys.
 */
public String getBqycpys() {
	return oppnents.getBqycpys();
}
/**
 * @param bqycpys The bqycpys to set.
 */
public void setBqycpys(String bqycpys) {
	oppnents.setBqycpys(bqycpys);
}
/**
 * @return oppnents. return oppnents.s the jzdsmc.
 */
public String getJzdsmc() {
	return oppnents.getJzdsmc();
}
/**
 * @param jzdsmc The jzdsmc to set.
 */
public void setJzdsmc(String jzdsmc) {
	oppnents.setJzdsmc(jzdsmc);
}
/**
 * @return oppnents. return oppnents.s the jzys.
 */
public String getJzys() {
	return oppnents.getJzys();
}
/**
 * @param jzys The jzys to set.
 */
public void setJzys(String jzys) {
	oppnents.setJzys(jzys);
}
/**
 * @return oppnents. return oppnents.s the optdate.
 */
public Date getOptdate() {
	return oppnents.getOptdate();
}
/**
 * @param optdate The optdate to set.
 */
public void setOptdate(Date optdate) {
	oppnents.setOptdate(optdate);
}
/**
 * @return oppnents. return oppnents.s the optrid.
 */
public String getOptrid() {
	return oppnents.getOptrid();
}
/**
 * @param optrid The optrid to set.
 */
public void setOptrid(String optrid) {
	oppnents.setOptrid(optrid);
}
/**
 * @return oppnents. return oppnents.s the qyid.
 */
public String getQyid() {
	return oppnents.getQyid();
}
/**
 * @param qyid The qyid to set.
 */
public void setQyid(String qyid) {
	oppnents.setQyid(qyid);
}
/**
 * @return oppnents. return oppnents.s the recstate.
 */
public String getRecstate() {
	return oppnents.getRecstate();
}
/**
 * @param recstate The recstate to set.
 */
public void setRecstate(String recstate) {
	oppnents.setRecstate(recstate);
}
/**
 * @return oppnents. return oppnents.s the remark.
 */
public String getRemark() {
	return oppnents.getRemark();
}
/**
 * @param remark The remark to set.
 */
public void setRemark(String remark) {
	oppnents.setRemark(remark);
}


}